<script setup>
import ActivityNoteList from "@/views/contract/common/activityNote/activityNoteList.vue";
import {reject} from "@/api/contract/processContract.js";
import {backProcessConList} from "@/utils/backList.js";
import {pageofficeOpenFile} from "@/plugins/pageoffice/pageoffice-common.js";

const {proxy} = getCurrentInstance()
const prop = defineProps({
  conId: {
    type: Number
  },
  openFileUrl: {
    type: String
  },
  isBack: {
    type: Boolean
  },
  isRefreshActivityNote: {
    type: Boolean
  },
})
const conId = prop.conId
const isCanAddActivityNote = ref(true)

function openFile() {
  pageofficeOpenFile(prop.openFileUrl, prop.conId)
}

function handleReject() {
  proxy.$modal.confirmAndExecuteJS('确认退回当前合同？', reject, conId, backProcessConList)
}

</script>

<template>
  <el-row>
    <el-col :span="12" :xs="24" class="left">
      <el-row>
        <el-form-item>
          <el-button @click="backProcessConList">返 回</el-button>
          <el-button type="primary" @click="openFile">打开正文</el-button>
          <el-button type="primary" @click="handleReject" v-if="isBack">退 回</el-button>
          <slot/>
        </el-form-item>
      </el-row>
    </el-col>
  </el-row>
  <!-- 流程信息列表 -->
  <ActivityNoteList :isRefreshActivityNote="isRefreshActivityNote" :isCanAddActivityNote="isCanAddActivityNote"/>
</template>

